function initMapVue(cn, en, lan, isChina, container, isSubViewer= false) {
  let tempViewer = null
  // 在线影像服务页面cn en为null
  if(cn&&en){
    imageLayersl_cn = new Cesium.ArcGisMapServerImageryProvider({
      url: cn
    })
    imageLayersl_en = new Cesium.ArcGisMapServerImageryProvider({
      url: en
    })
  }else{
    imageLayersl_cn = new Cesium.SingleTileImageryProvider({
      url: 'static/web/js/Cesium/Assets/Textures/earth_color_low_4096.jpg',
    });
    imageLayersl_en = new Cesium.SingleTileImageryProvider({
      url: 'static/web/js/Cesium/Assets/Textures/earth_color_low_4096.jpg',
    });
  }

  tempViewer = new Cesium.Viewer(container, {
    animation: false, //是否显示动画控件
    baseLayerPicker: false, //是否显示图层选择控件
    geocoder: false, //是否显示地名查找控件
    timeline: false, //是否显示时间线控件
    sceneModePicker: false, //是否显示投影方式控件 3D 2D切换
    navigationHelpButton: false, //是否显示帮助信息控件
    infoBox: false, //是否显示点击要素之后显示的信息
    homeButton: !1,
    fullscreenButton: false,
    selectionIndicator: !1,
    imageryProvider: imageLayersl_cn
  });
  
  slimage_cn = tempViewer.imageryLayers.get(0);
  slimage_en = tempViewer.imageryLayers.addImageryProvider(imageLayersl_en);
  if(lan == 'zh-CN') {
    slimage_en.show = false;
  }else {
    slimage_cn.show = false;
  }
  // console.log(lan)
  
  scene = tempViewer.scene;
  tempViewer.scene.highDynamicRange = false;
  tempViewer.scene.globe.showGroundAtmosphere = false;

  //隐藏logo
	tempViewer._cesiumWidget._creditContainer.style.display = "none";

  if(isChina) {
    tempViewer.scene.skyBox = new Cesium.SkyBox({
      sources : {
        positiveX : 'static/web/js/Cesium/img/r.JPG',
        negativeX : 'static/web/js/Cesium/img/l.JPG',
        positiveY : 'static/web/js/Cesium/img/f.JPG',
        negativeY : 'static/web/js/Cesium/img/b.JPG',
        positiveZ : 'static/web/js/Cesium/img/u.JPG',
        negativeZ : 'static/web/js/Cesium/img/d.JPG'
      }
    });

    //设置中国初始位置
    var rectangle = new Cesium.Rectangle.fromDegrees(80, 22, 130, 50);
    tempViewer.camera.flyTo({
      destination : rectangle,
      // duration : 8
      //maximumHeight:25000000
    });
  }else {
    tempViewer.scene.skyBox = new Cesium.SkyBox({
      sources : {
        positiveX : 'static/web/js/Cesium/img/1.JPG',
        negativeX : 'static/web/js/Cesium/img/1.JPG',
        positiveY : 'static/web/js/Cesium/img/1.JPG',
        negativeY : 'static/web/js/Cesium/img/1.JPG',
        positiveZ : 'static/web/js/Cesium/img/1.JPG',
        negativeZ : 'static/web/js/Cesium/img/1.JPG'
      }
    });
  }

  // var modelMatrix = new Cesium.Transforms.eastNorthUpToFixedFrame(new Cesium.Cartesian3.fromDegrees(110.62898254394531, 40.02804946899414, 6.0));        //gltf数据加载位置
  // viewer.scene.primitives.add(new Cesium.Model.fromGltf({
  //   url: require('@/assets/3dModel/td_new.gltf'), //gltf⽂件的URL
  //   modelMatrix: modelMatrix,
  //   scale: 10000.0    //放⼤倍数
  // }));
  if(!isSubViewer){
    viewer = tempViewer
  }


 // 拾取鼠标位置
//  var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);

//  handler.setInputAction(function (movement) {
//      var position = viewer.scene.pickPosition(movement.position);

//      if (position) {

//          var cartographic = Cesium.Cartographic.fromCartesian(position);
//          var longitude = Cesium.Math.toDegrees(cartographic.longitude).toFixed(5);
//          var latitude = Cesium.Math.toDegrees(cartographic.latitude).toFixed(5);
//          var height = cartographic.height.toFixed(3);


//          console.log(position,longitude,latitude,height);
//      }
//  }, Cesium.ScreenSpaceEventType.LEFT_CLICK);



  return tempViewer
};

function mapToCN() {
  if(viewer) {
    slimage_cn.show = true
    slimage_en.show = false
  }
}

function mapToEN() {
  if(viewer) {
    slimage_en.show = true
    slimage_cn.show = false
  }
}

function initPosition() {
  viewer.camera.flyTo({
    destination : new Cesium.Rectangle.fromDegrees(80, 22, 130, 50)
  });
}

function mapdestroy() {
  viewer.destroy()
}

//=============================================================
/**
 * 去除图片黑边，计算黑边的临界点的纹理坐标
 * @params {String}image 图片路径
 * @params {Cesium.PixelFormat}[pixelFormat=Cesium.PixelFormat.RGBA] 图片像素点格式 默认 rgba
 * @params {Array}[ignoreBlackRGBUpper=[12, 12, 12]] 忽略黑边RGB上限值 默认
 * @params {Array}[ignoreBlackRGBLower=[0, 0, 0]] 忽略黑边RGB下限值 默认
 * @return {Promise} 计算状态，返回uv
 *
 * @example:
 *      var ps = calcUVsWithoutBlakEdge('HJ1A-CCD1-399-33-20200608-L20004035709.jpg');
 *      ps.then(function(uvs){
 *
 *      });
 *
 */
async function calcUVsWithoutBlakEdge(image, pixelFormat, ignoreBlackRGBUpper, ignoreBlackRGBLower) {
  function l(a) { a = a.toString(16); return a = 2 > a.length ? "0" + a : a } pixelFormat = Cesium.defaultValue(Cesium.PixelFormat.RGBA); var e = Cesium.defaultValue(ignoreBlackRGBUpper, [12, 12, 12]), h = Cesium.defaultValue(ignoreBlackRGBLower, [0, 0, 0]), a = [0, 1, 0, 0, 1, 0, 1, 1], t = document.createElement("canvas"), G = new Promise(function (a, e) { var f = new Image; f.onload = function () { t.width = f.width; t.height = f.height; var e = t.getContext("2d"); e.drawImage(f, 0, 0); e = e.getImageData(0, 0, f.width, f.height); a(e) }; f.onerror = function () { e() }; f.src = image }); return new Promise(function (t, u) { G.then(function (f) { if (!(Cesium.defined(e) && e instanceof Array) || 3 > e.length) e = [36, 36, 36]; if (!(Cesium.defined(h) && h instanceof Array) || 3 > h.length) h = [0, 0, 0]; e[0] = 0 <= e[0] && 255 >= e[0] ? parseInt(e[0]) : 36; e[1] = 0 <= e[1] && 255 >= e[1] ? parseInt(e[1]) : 36; e[2] = 0 <= e[2] && 255 >= e[2] ? parseInt(e[2]) : 36; h[0] = 0 <= h[0] && 255 >= h[0] ? parseInt(h[0]) : 0; h[1] = 0 <= h[1] && 255 >= h[1] ? parseInt(h[1]) : 0; h[2] = 0 <= h[2] && 255 >= h[2] ? parseInt(h[2]) : 0; var p = 1 * ("0x" + l(e[0]) + l(e[1]) + l(e[2])), b = 1 * ("0x" + l(h[0]) + l(h[1]) + l(h[2])), v = Math.max(p, b), p = Math.min(p, b), b = pixelFormat == Cesium.PixelFormat.RGBA ? 4 : 3, g = f.width, n = f.height; f = f.data; for (var w = 0, x = 0, c = 0; c < n; c++) { for (var m = !1, d = 0; d < g; d++) { var k = f[c * g * b + d * b + 0], q = f[c * g * b + d * b + 1], r = f[c * g * b + d * b + 2], k = 1 * ("0x" + l(k) + l(q) + l(r)); if (k > v || k < p) { w = d; x = c; m = !0; break } } if (m) break } for (var w = w / g, x = x / n, y = 0, z = 0, d = 0; d < g; d++) { m = !1; for (c = 0; c < n; c++)if (k = f[c * g * b + d * b + 0], q = f[c * g * b + d * b + 1], r = f[c * g * b + d * b + 2], k = 1 * ("0x" + l(k) + l(q) + l(r)), k > v || k < p) { y = d; z = c; m = !0; break } if (m) break } for (var y = y / g, z = z / n, A = 0, B = 0, c = n - 1; 0 <= c; c--) { m = !1; for (d = 0; d < g; d++)if (k = f[c * g * b + d * b + 0], q = f[c * g * b + d * b + 1], r = f[c * g * b + d * b + 2], k = 1 * ("0x" + l(k) + l(q) + l(r)), k > v || k < p) { A = d; B = c; m = !0; break } if (m) break } for (var A = A / g, B = B / n, u = 0, D = 0, d = g - 1; 0 <= d; d--) { m = !1; for (c = 0; c < n; c++)if (k = f[c * g * b + d * b + 0], q = f[c * g * b + d * b + 1], r = f[c * g * b + d * b + 2], k = 1 * ("0x" + l(k) + l(q) + l(r)), k > v || k < p) { u = d; D = c; m = !0; break } if (m) break } a[0] = w; a[1] = 1 - x; a[2] = y; a[3] = 1 - z; a[4] = A; a[5] = 1 - B; a[6] = u / g; a[7] = 1 - D / n; t([[a[0], a[1]], [a[6], a[7]], [a[4], a[5]], [a[2], a[3]]]) }, function () { t([[a[0], a[1]], [a[6], a[7]], [a[4], a[5]], [a[2], a[3]]]) }) })
}
async function createdPrimitiveEntity(polygon,id,viewer,flag,url,prolevel){
  //4个角点坐标
  // var lonlat1 = [0.0, 88.365, 0],
  //   lonlat2 = [90.0, 88.365, 0],
  //   lonlat3 = [180.0, 88.365, 0],
  //   lonlat4 = [-90.0, 88.365, 0];
  var height = 80000;
  // var height = 0;
  // var lonlat1 = [polygon[0], polygon[1], height],
  //   lonlat2 = [polygon[2], polygon[3], height],
  //   lonlat3 = [polygon[4], polygon[5], height],
  //   lonlat4 = [polygon[6], polygon[7], height];
  var lonlat1 = [polygon[6], polygon[7], height],
      lonlat2 = [polygon[4], polygon[5], height],
      lonlat3 = [polygon[2], polygon[3], height],
      lonlat4 = [polygon[0], polygon[1], height];

  var pt1 = Cesium.Cartesian3.fromDegrees(lonlat1[0], lonlat1[1], lonlat1[2] || 0),
    pt2 = Cesium.Cartesian3.fromDegrees(lonlat2[0], lonlat2[1], lonlat2[2] || 0),
    pt3 = Cesium.Cartesian3.fromDegrees(lonlat3[0], lonlat3[1], lonlat3[2] || 0),
    pt4 = Cesium.Cartesian3.fromDegrees(lonlat4[0], lonlat4[1], lonlat4[2] || 0);

  var points = [pt1, pt2, pt3, pt4];
  var uvs = [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]];
  if(prolevel == 2){
    var ps = await calcUVsWithoutBlakEdge(url);
    uvs = ps;
    uvs = [uvs[3], uvs[2], uvs[1], uvs[0]]
    /*await ps.then(function (data) {
      uvs = data;
    })*/
  }
  var positionArr = [], //顶点
    stsArr = [],      //纹理
    indiceArr = [];   //索引
  for (var i = 0; i < points.length; i++) {
    positionArr.push(points[i].x, points[i].y, points[i].z);
    stsArr.push(uvs[i][0], uvs[i][1]);
    if (i < 3) {
      indiceArr.push(i);
    } else {
      indiceArr.push(0, i - 1, i);
    }
  }

  var positionFloatArr = new Float64Array(positionArr);
  var sts = new Float32Array(stsArr);
  var indices = new Uint16Array(indiceArr);
  var geometryXYZ = new Cesium.Geometry({
    attributes: {
      position: new Cesium.GeometryAttribute({
        componentDatatype: Cesium.ComponentDatatype.DOUBLE,
        componentsPerAttribute: 3,
        values: positionFloatArr
      }),
      st: new Cesium.GeometryAttribute({
        componentDatatype: Cesium.ComponentDatatype.FLOAT,
        componentsPerAttribute: 2,
        values: sts
      })
    },
    indices: indices,
    primitiveType: Cesium.PrimitiveType.TRIANGLES,
    boundingSphere: Cesium.BoundingSphere.fromVertices(positionFloatArr)
  });
  var material = new Cesium.Material({
    fabric: {
      //颜色方式
      type: 'Color',
      uniforms: {
        color: Cesium.Color.BLUE.withAlpha(0.1),
      }
    }
  })
  var materialImg = null;
  if(flag) {
    materialImg = new Cesium.Material({
      fabric: {
        //纹理方式
        type: 'Image',
        uniforms: {
          image: url
        },
      }
    })
    material = materialImg
  }
  var appearance = new Cesium.EllipsoidSurfaceAppearance({
    material: material,
    aboveGround: true,
    faceForward: true,
    flat: true,
    translucent: true,
    renderState: {
      blending: Cesium.BlendingState.PRE_MULTIPLIED_ALPHA_BLEND,
      depthTest: { enabled: true },
      depthMask: true,
    }
  });
  var primitive = new Cesium.Primitive({
    geometryInstances: new Cesium.GeometryInstance({
      geometry: geometryXYZ
    }),
    appearance: appearance,
    depthFailAppearance: flag?appearance:undefined,
    asynchronous: false
  });
  viewer.scene.primitives.add(primitive);
  primitive.id = id;
  return {
    "primitiveEntity": primitive,
  };
}
function createDCentity(polygon,id,viewer,entityColor,type){
  let PrimitiveCollection = new Cesium.PrimitiveCollection()
  polygon.forEach((item, index) => {
    let volume = new Cesium.PolylineVolumeGeometry({
      polylinePositions: Cesium.Cartesian3.fromDegreesArrayHeights(item),
      shapePositions: computeCircle(60000.0)
    });
    let primitive = new Cesium.Primitive({
      geometryInstances: new Cesium.GeometryInstance({
        geometry: volume
      }),
      appearance: new Cesium.EllipsoidSurfaceAppearance({
        aboveGround: false,
        meterial: new Cesium.Material()
      })
    })
    primitive.appearance.material.uniforms.color = Cesium.Color.BLUE.withAlpha(0.5)
    PrimitiveCollection.add(primitive, index)
  })

  PrimitiveCollection._id = id
  viewer.scene.primitives.add(PrimitiveCollection)

  return PrimitiveCollection;

  // var redTube = viewer.entities.add({
  //   //name : 'Red tube with rounded corners',
  //   id: id,
  //   polylineVolume: {
  //     positions : Cesium.Cartesian3.fromDegreesArrayHeights(polygon),
  //     //positions : Cesium.Cartesian3.fromDegreesArray(polygon),
  //     shape : computeCircle(60000.0),
  //     material : Cesium.Color.BLUE.withAlpha(0.15)
  //   }
  // });
  // return redTube;

  // var geometryInstances = [];
  // polygon.forEach(function (item, idx) {
  //   var geoInstance = new Cesium.GeometryInstance({
  //     geometry: new Cesium.PolylineGeometry({
  //       // positions: Cesium.Cartesian3.fromDegreesArray(item),
  //       positions: Cesium.Cartesian3.fromDegreesArrayHeights(item),
  //       width: 50.0,
  //     }),
  //     attributes: {
  //       // color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.BLUE.withAlpha(0.15))
  //       color: new Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.BLUE.withAlpha(0.15))
  //     }
  //   });
  //   geometryInstances.push(geoInstance);
  // });

  // var primitive = new Cesium.Primitive({
  //   geometryInstances: geometryInstances,
  //   appearance: new Cesium.PolylineColorAppearance({
  //     translucent: false
  //   })
  // });

  // viewer.scene.primitives.add(primitive);

  // return primitive;
}

function computeCircle(radius) {
  var positions = [];
  for (var i = 0; i < 360; i++) {
    var radians = Cesium.Math.toRadians(i);
    positions.push(new Cesium.Cartesian2(radius * Math.cos(radians), radius * Math.sin(radians)));
  }
  return positions;
}

function createBlueGridPolygon(polygon, index, viewer) {
  var bluePolygon = viewer.entities.add({
    id: index,
    name : 'polyline',
    polyline : {
      positions : Cesium.Cartesian3.fromDegreesArray(polygon),
      width: 1.0,
      material : Cesium.Color.fromBytes(113, 136, 142, 0.6*255)
    }
  });
  return bluePolygon;
}

function createBlueSingleGridPolygon(polygon, viewer) {
  var bluePolygon = viewer.entities.add({
    id: '',
    name : 'polyline',
    polyline : {
      positions : Cesium.Cartesian3.fromDegreesArray(polygon),
      width: 1.0,
      material : Cesium.Color.RED
    }
  });
  return bluePolygon;
}

function createBlueIntersectsEntity(polygon,id,viewer,entityColor,type){
  // var polygonArr = [[polygon[0],polygon[1]],[polygon[2],polygon[3]],[polygon[4],polygon[5]],[polygon[6],polygon[7]],[polygon[8],polygon[9]]];
  // var imageryLayer = new Cesium.OverlayImageryProvider({
  //   id: id,
  //   url: 'static/web/images/1.png',
  //   credit: 'image1',
  //   rectangleQuad: polygonArr,
  //   reverse: true,
  //   occupationLayer: true,
  //   lineWidth: 1,
  // });
  // var layer = viewer.imageryLayers.addImageryProvider(imageryLayer)
  // layer.alpha=0.0;
  // layer.id=id;
  // return {
  //   "imageryProvider":imageryLayer,
  //   "imageryLayer":layer
  // };
  
  var color = colorToEntityColor(entityColor);
  var bluePolygon = viewer.entities.add({
    id: id,
    name: id,
    polygon: {
      hierarchy: {
        positions : Cesium.Cartesian3.fromDegreesArray(polygon),
      },
      material: Cesium.Color.BLUE.withAlpha(0.01),//Cesium.Color.BLUE.withAlpha(0.05),
      height: 2,
      outline: true, // height is required for outline to display
      outlineColor: color[1],//Cesium.Color.BLUE.withAlpha(0),
      outlineWidth: 4
    }
  });

  return bluePolygon;
}

function createBlueIntersectsEntityHeights(polygon,id,viewer){
  var bluePolygon = viewer.entities.add({
    id: id,
    name : id,
    polygon: {
      hierarchy : {
        positions : Cesium.Cartesian3.fromDegreesArrayHeights(polygon),
      },
      perPositionHeight : true,
      material : Cesium.Color.BLUE.withAlpha(0.1),
      //height : 0,
      outline : true, // height is required for outline to display
      outlineColor :  Cesium.Color.BLUE.withAlpha(0.1),
      outlineWidth : 4,
      arcType : Cesium.ArcType.RHUMB,
    }
  });

  return bluePolygon;
}

function createBluePointEntity(polygon,id,viewer,width,entityColor,type) {
  /*var points = new Cesium.PointPrimitiveCollection();
  viewer.scene.primitives.add(points);
  var point = new Cesium.PointPrimitive({
    id:id,
    position:Cesium.Cartesian3.fromDegrees(polygon[0],polygon[1]),
    color : Cesium.Color.BLUE,
    pixelSize : 20
  });
  points.add(point)
  return points;*/
  /*var pointEntity = viewer.entities.add({
    id:id,
    position : Cesium.Cartesian3.fromDegrees(polygon[0],polygon[1]),
    point : {
      color :  Cesium.Color.BLUE,
      pixelSize : 20,
      outlineColor:Cesium.Color.GRAY,
      outlineWidth:1,
    }
    /!*ellipsoid:{
      radii: new Cesium.Cartesian3(13000, 13000, 13000), //设置球体的xyz
      material: Cesium.Color.BLUE,
      outline:true,
      outlineColor:Cesium.Color.RED,
      outlineWidth:10,

      stackPartitions:50,
      slicePartitions:50
    }*!/
  });*/
  var color = colorToEntityColor(entityColor,type);
  var pointEntity = viewer.entities.add({
    id:id,
    position: Cesium.Cartesian3.fromDegrees(polygon[0],polygon[1], 5000.0),
    box : {
      dimensions : new Cesium.Cartesian3(width, width, 5000.0),
      material : color[0]//Cesium.Color.entityColor.withAlpha(0.8)
    }
    /*cylinder : {
      length : 5000.0,
      topRadius : 10000.0,
      bottomRadius : 10000.0,
      material : Cesium.Color.DARKSLATEBLUE.withAlpha(0.8),
    }*/
  });
  return pointEntity;
}

function createBlueLineEntity(polygon,id,viewer,entityColor,type) {
  var color = colorToEntityColor(entityColor,type);
  var lineEntity =  viewer.entities.add({
    id:id,
    name: 'polyline',
    polyline: {
      positions: Cesium.Cartesian3.fromDegreesArrayHeights(polygon),
      width: 1,
      //material: Cesium.Color.BLUE,
      material:new Cesium.PolylineDashMaterialProperty({
        color:color[0]//Cesium.Color.BLUE,
      })
    }
  });
  viewer.flyTo(lineEntity,{
    offset:new Cesium.HeadingPitchRange(
      0, Cesium.Math.toRadians(-10.0), 0)
  });
  return lineEntity;

}

function createBlueSingleLinesEntity(polygon,id,viewer,entityColor,type) {
  var color = colorToEntityColor(entityColor, type);
  var lineEntity = viewer.entities.add({
    id: id,
    name: 'polyline',
    polyline: {
      positions: Cesium.Cartesian3.fromDegreesArray(polygon),
      width: 4,
      material: new Cesium.PolylineDashMaterialProperty({
        color: Cesium.Color.BLUE,
        dashPattern: parseInt("1010101010101010", 2)
      })
    }
  });
  // viewer.flyTo(lineEntity);
  return lineEntity;
}

function createGeneralBlueLineEntity(polygon,id,viewer,entityColor,type) {
  var color = colorToEntityColor(entityColor,type);
  var lineEntity =  viewer.entities.add({
    id:id,
    name: 'polyline',
    polyline: {
      positions: Cesium.Cartesian3.fromDegreesArrayHeights(polygon),
      width: 4,
      material: Cesium.Color.BLUE,
      /*material:new Cesium.PolylineDashMaterialProperty({
        color:color[0]//Cesium.Color.BLUE,
      })*/
    }
  });
  viewer.flyTo(lineEntity);
  return lineEntity;

}

function createBlueLinesEntity(polygon,id,viewer,entityColor,type,width) {
  var color = colorToEntityColor(entityColor);
  var positions = Cesium.CorridorGeometry.recomputeCenterPositions(Cesium.Cartesian3.fromDegreesArray(polygon), 2600*1000*2.8);
  // var positions = Cesium.Cartesian3.fromDegreesArray(polygon);
  var entity = viewer.entities.add({
    id: id,
    corridor: {
      positions: positions,
      height: 0,
      extrudedHeight: 0,//椭圆表面和挤压面之间的距离（米）。
      width: width,  //走廊边缘之间的距离，以米为单位  2600000.0
      cornerType: Cesium.CornerType.BEVELED,//确定角的样式。Cesium.CornerType.BEVELED 角被剪切；Cesium.CornerType.MITERED角点是相邻边的交点；Cesium.CornerType.ROUNDED角有光滑的边缘
      // extrudedHeightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
      // heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
      material: Cesium.Color.BLUE.withAlpha(0.3),//color[0],//Cesium.Color.ORANGE.withAlpha(0),
      stRotation: Cesium.Math.toRadians(-90), //纹理坐标旋转角度 弧度 正值表示逆时针旋转
      // granularity: Cesium.Math.RADIANS_PER_DEGREE * 20,
      // rotation: Cesium.Math.toRadians(90),
      outline: true,//轮廓
      outlineColor: Cesium.Color.BLUE.withAlpha(0)
    }
  });
  return entity;
}

function createBlueBreadthLinesEntity(polygon,id,viewer,entityColor,type) {
  var color = colorToEntityColor(entityColor);
  var positions = Cesium.CorridorGeometry.recomputeCenterPositions(Cesium.Cartesian3.fromDegreesArray(polygon), 16000.0);////268000

  var entity = viewer.entities.add({
    id: id,
    corridor: {
      positions:  positions,
      height: 0,
      extrudedHeight: 0,//椭圆表面和挤压面之间的距离（米）。
      width: 16000.0,  //走廊边缘之间的距离，以米为单位  2600000.0
      cornerType: Cesium.CornerType.BEVELED,//确定角的样式。Cesium.CornerType.BEVELED 角被剪切；Cesium.CornerType.MITERED角点是相邻边的交点；Cesium.CornerType.ROUNDED角有光滑的边缘
      //extrudedHeightReference:Cesium.HeightReference.CLAMP_TO_GROUND,
      //heightReference:Cesium.HeightReference.CLAMP_TO_GROUND,
      material: Cesium.Color.BLUE.withAlpha(0.3),//color[0],//Cesium.Color.ORANGE.withAlpha(0),
      stRotation: Cesium.Math.toRadians(-90), //纹理坐标旋转角度 弧度 正值表示逆时针旋转
      //granularity: Cesium.Math.RADIANS_PER_DEGREE,
      //rotation : Cesium.Math.toRadians(90),
      outline : true,//轮廓
      outlineColor :Cesium.Color.BLUE.withAlpha(0)
    }
  });
  return entity;
}

/*世界坐标转经纬度*/
function cartesian3ToJingwei(x,y,z,ellipsoid){
    //var ellipsoid=viewer.scene.globe.ellipsoid;
    var cartesian3=new Cesium.Cartesian3(x,y,z);
    var cartographic=ellipsoid.cartesianToCartographic(cartesian3);
    var lat=Cesium.Math.toDegrees(cartographic.latitude);
    var lng=Cesium.Math.toDegrees(cartographic.longitude);
    var alt=cartographic.height;
    return lng+" "+lat;
}

function colorToEntityColor(color,type){
  var entityColor=Cesium.Color.BLUE.withAlpha(0.1);
  var entityColorTwo=Cesium.Color.BLUE.withAlpha(1);

  if(color=="green"){
    entityColor=Cesium.Color.GREEN.withAlpha(0.1);
    entityColorTwo=Cesium.Color.GREEN.withAlpha(1);
    if(type=="point")
    entityColor=Cesium.Color.GREEN.withAlpha(0.5);
    if(type=="line")
    entityColor=Cesium.Color.GREEN.withAlpha(1);
  }else if(color=="yellow"){
    entityColor=Cesium.Color.YELLOW.withAlpha(0.1);
    entityColorTwo=Cesium.Color.YELLOW.withAlpha(1);
    if(type=="point")
    entityColor=Cesium.Color.YELLOW.withAlpha(0.5);
    if(type=="line")
      entityColor=Cesium.Color.YELLOW.withAlpha(1);
  }else if (color=="blue"){
    entityColor=Cesium.Color.BLUE.withAlpha(0.1);
    entityColorTwo=Cesium.Color.BLUE.withAlpha(1);
    if(type=="point")
    entityColor=Cesium.Color.BLUE.withAlpha(0.5);
    if(type=="line")
      entityColor=Cesium.Color.BLUE.withAlpha(1);
  }else if(color=="purple"){
    entityColor=Cesium.Color.PURPLE.withAlpha(0.1);
    entityColorTwo=Cesium.Color.PURPLE.withAlpha(1);
    if(type=="point")
    entityColor=Cesium.Color.PURPLE.withAlpha(0.5);
    if(type=="line")
      entityColor=Cesium.Color.PURPLE.withAlpha(1);
  }else {
    entityColor=Cesium.Color.BLUE.withAlpha(0);
    entityColorTwo=Cesium.Color.BLUE.withAlpha(0);
  }
  return [entityColor,entityColorTwo];
}